/*
 * @Author: your name
 * @Date: 2021-12-29 14:57:00
 * @LastEditTime: 2022-01-01 16:58:16
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \order-uid:\老师的\app\briup-wisdom-order\src\store\index.js
 */
import Vue from 'vue'
import Vuex from 'vuex'
// 引入注册模块
import register from './register/register'
// 引入用户模块
import user from './user/user'
// 引入栏目模块
import category from './category/category'
// 引入产品模块
import product from './product/product'
// import user1 from './user1/user1'
import address from './address/address'
import recharge from './recharge/recharge'
// 购物车
import shopcar from './shopcar/shopcar'
import order from './order/order'
import productOrder from './productOrder/productOrder'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // token存储
    token: localStorage.getItem('token') ? localStorage.getItem('token') : ''
  },
  mutations: {
    //存储token
    setToken(state, token) {
      state.token = token;
      localStorage.setItem("token", token.token);
    },
    //删除token
    delToken(state) {
      state.token = '';
      localStorage.removeItem("token");
    }
  },
  actions: {
  },
  modules: {
    // 注册模块
    register,
    // 用户模块
    user,
    
    // 栏目模块
    category,
    // 产品模块
    product,
    // 地址
    address,
    recharge,
    // user1
    shopcar,
    order,
    productOrder,
  }
})
